<table width="100%" cellspacing="0">
<tbody>
<tr>
<td valign="top" style="width:300px">
<form action="" method="post" name="add" id="add">
	<table width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #bbbbbb" class="filterForm">
		<tr>
			<td colspan="2" bgcolor="#dddddd" style="padding-bottom:0px">
				<table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin-bottom:0px">
				  <tbody>
					<tr>
					  <td bgcolor="#dddddd" height="20" style="padding-bottom:0px">
					  <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:0px;">
						  <tbody>
							<tr>
							  <td width="1%"><b>Select:</b>&nbsp;</td>
							  <td width="1%">&nbsp;</td>
							  <td align="center" nowrap="nowrap" width="10%"><a href="<?=$this->baseUrl()?>/filter/view"><b>View</b></a></td>
							  <td width="1%">&nbsp;</td>
							  <td width="10%" align="center" bgcolor="#AAAAAA">
							  	<a style="padding: 4px 7px"><font color="#ffffff"><b>New</b></font></a>							  </td>
								<td width="1%">&nbsp;</td>
							  <td align="center" width="10%"><a href="<?=$this->baseUrl()?>/filter/manage"><b>Manage</b></a></td>
							  <td width="1%">&nbsp;</td>
							</tr>
						  </tbody>
					  </table></td>
					</tr>
				  </tbody>
				</table>			</td>
		</tr>
		<tr>
			<td colspan="2">
<table border="0" cellpadding="3" cellspacing="0">
				  <tbody>
					<tr>
					  <td>You are currently using a new, unsaved search.</td>
					</tr>
					<?php if($this->issuesData) { ?>
					<tr>
					  <td><a href="<?=$this->baseUrl()?>/filter/save"><b>Save</b></a> it as filter</td>
					</tr>
					<?php }?>
				  </tbody>
				</table>
			</td>
		<tr>
		<tr>
			<td colspan="2" align="center" bgcolor="#F0F0F0">
				<input name="hide" value="&lt;&lt; View &amp; Hide" type="submit">
				<input name="show" value="View &gt;&gt;" type="submit">			</td>
		</tr>
		<tr>
			<td width="32%" bgcolor="#FFFFF0">Project:</td>
			<td width="68%" bgcolor="#FFFFFf">
				<select name="projects[]" id="project" multiple="multiple" size="3">
					<option value="">All Projects</option>
					<?php foreach ($this->projects  as $project) {?>
						<option "<?php if(!empty($this->params['projects']) && in_array($project['id'], $this->params['projects'])) { echo "selected='selected'";}?>" value="<?=$project['id']?>"><?=$project['pname']?></option>
					<?php } ?>
			  </select>			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Issue Type:</td>
			<td bgcolor="#FFFFFf">
				<select name="issuetype[]" id="issueType" multiple="multiple" size="3" class="imagebacked">
					<option value="">Any</option>
					<?php foreach ($this->issueTypeData  as $issueData) {?>
						<option "<?php if(!empty($this->params['issuetypes']) && in_array($issueData['id'], $this->params['issuetypes'])) { echo "selected='selected'";}?>" style="background:url(<?=$this->baseUrl().$issueData['icon_url']?>) no-repeat;" value="<?=$issueData['id']?>"><?=$issueData['pname']?></option>
					<?php } ?>
			  </select>			</td>
		</tr>
		<tr>
			<td height="24" colspan="2" bgcolor="#F0F0F0"><strong>Text Search</strong></td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Query:</td>
			<td><input id="query" name="query" class="standardInputField" value="<?=$this->params['query']['text']?>" type="text"></td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Query Fields</td>
			<td>
				<Table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td><input type="checkbox" name="summary" id="summary" <?php if($this->params['query']['summary']) { echo "checked";}?>/>
							<label for="summary">Summary</label>						</td>
						<td><input type="checkbox" name="description" id="description" <?php if($this->params['query']['description']) { echo "checked";}?>/>
							<label for="description">Description</label>						</td>
					</tr>
					<tr>
						<td><input type="checkbox" name="comments" id="comments" <?php if($this->params['query']['comments']) { echo "checked";}?>/>
							<label for="comments">Comments</label>						</td>
						<td><input type="checkbox" name="environment" id="environment" <?php if($this->params['query']['environment']) { echo "checked";}?>/>
							<label for="environment">Environment</label>						</td>
					</tr>
				</Table>			</td>
		</tr>
		<tr>
			<td height="24" colspan="2" bgcolor="#F0F0F0"><strong>Issue Attributes</strong></td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Reporter</td>
			<td>
				<select name="reporter" id="reporter" onChange="if(this.value=='specify') document.getElementById('reporterName').disabled = false; else document.getElementById('reporterName').disabled = 'disabled';">
					<option value="any" <?php if($this->params['reporter'] == 'any') echo 'selected';?>>Any User</option>
					<option value="no" <?php if($this->params['reporter'] == 'no') echo 'selected';?>>No Reporter</option>
					<option value="current" <?php if($this->params['reporter'] == 'current') echo 'selected';?>>Current User</option>
					<option value="specify" <?php if($this->params['reporter'] == 'specify') echo 'selected';?>>Specify User</option>
				</select>			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">&nbsp;</td>
			<td><input name="reporterName" id="reporterName" <?php if($this->params['reporter'] != 'specify' && !isset($this->params['reporterName'])) echo 'disabled= "disabled"';?> value="<?=$this->params['reporterName']?>"/></td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Assignee</td>
			<td>
				<select name="assignee" id="assignee" onChange="if(this.value=='specify') document.getElementById('assigneeName').disabled = false; else document.getElementById('assigneeName').disabled = 'disabled';">
					<option value="any" <?php if($this->params['assignee'] == 'any') echo 'selected';?>>Any User</option>
					<option value="no" <?php if($this->params['assignee'] == 'no') echo 'selected';?>>No Reporter</option>
					<option value="current" <?php if($this->params['assignee'] == 'current') echo 'selected';?>>Current User</option>
					<option value="specify" <?php if($this->params['assignee'] == 'specify') echo 'selected';?>>Specify User</option>
				</select>			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">&nbsp;</td>
			<td><input name="assigneeName" id="assigneeName" <?php if($this->params['assignee'] != 'specify' && !isset($this->params['assigneeName'])) echo 'disabled= "disabled"';?> value="<?=$this->params['assigneeName']?>"/></td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#FFFFF0">Status:</td>
			<td>
				<select name="status[]" id="status" multiple="multiple" size="4" class="imagebacked">
					<option value="">Any</option>
					<?php foreach ($this->statusData  as $status) {?>
						<option "<?php if(!empty($this->params['statuses']) && in_array($status['id'], $this->params['statuses'])) { echo "selected='selected'";}?>" style="background:url(<?=$this->baseUrl().$status['icon_url']?>) no-repeat;" value="<?=$status['id']?>"><?=$status['pname']?></option>
					<?php } ?>
			  </select>			</td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#FFFFF0">Resolutions:</td>
			<td><select name="resolution[]" id="resolution[]" multiple="multiple" size="4">
              <option value="">Any</option>
              <?php foreach ($this->resolutions  as $resolution) {?>
              <option "<?php if(!empty($this->params['resolutions']) && in_array($resolution['id'], $this->params['resolutions'])) { echo "selected='selected'";}?>" value="<?=$resolution['id']?>">
                <?=$resolution['pname']?>
                </option>
              <?php } ?>
            </select></td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Priorities:</td>
			<td>
				<select name="priority[]" id="priority[]" multiple="multiple" size="4" class="imagebacked">
				  <option value="">Any</option>
				  <?php foreach ($this->priorities  as $priority) {?>
				  <option "<?php if(!empty($this->params['priorities']) && in_array($priority['id'], $this->params['priorities'])) { echo "selected='selected'";}?>" value="<?=$priority['id']?>" style="background:url(<?=$this->baseUrl().$priority['icon_url']?>) no-repeat;">
					<?=$priority['pname']?>
				  </option>
				  <?php } ?>
			  </select>			</td>
		</tr>
		<tr>
			<td height="24" colspan="2" bgcolor="#F0F0F0"><strong>Dates and Times</strong></td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Created After:</td>
			<td>
				<input class="dateSearcher" name="createdAfter" id="createdAfter" value="<?=$this->params['createdAfter']?>" title="Retrieves issues created after or on this date" type="text">			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Created Before:</td>
			<td>
				<input class="dateSearcher" name="createdBefore" id="createdBefore" value="<?=$this->params['createdBefore']?>" title="Retrieves issues created before or on this date" type="text">			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Created:</td>
			<td>
				<label for="createdPrevious" class="label">From</label>
				<input name="createdPrevious" id="createdPrevious" class="periodSearcher" value="" type="text" style="width:40px">
				<label for="createdNext" class="label">To</label>
				<input name="createdNext" id="createdNext" class="periodSearcher" value="" type="text" style="width:40px">
				<div class="fieldDescription">Use this picker for relative dates</div>			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Updated After:</td>
			<td>
				<input class="dateSearcher" name="updatedAfter" id="updatedAfter" value="<?=$this->params['updatedAfter']?>" title="Retrieves issues updated after or on this date" type="text">			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Updated Before:</td>
			<td>
				<input class="dateSearcher" name="updatedBefore" id="updatedBefore" value="<?=$this->params['updatedBefore']?>" title="Retrieves issues updated before or on this date" type="text">			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Updated:</td>
			<td>
				<label for="updatedPrevious" class="label">From</label>
				<input name="updatedPrevious" id="updatedPrevious" class="periodSearcher" value="" type="text" style="width:40px">
				<label for="updatedNext" class="label">To</label>
				<input name="updatedNext" id="updatedNext" class="periodSearcher" value="" type="text" style="width:40px">
				<div class="fieldDescription">Use this picker for relative dates</div>			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Due After:</td>
			<td>
				<input class="dateSearcher" name="duedateAfter" id="duedateAfter" value="<?=$this->params['duedateAfter']?>" title="Retrieves issues due after or on this date" type="text">			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Due Before:</td>
			<td>
				<input class="dateSearcher" name="duedateBefore" id="duedateBefore" value="<?=$this->params['duedateBefore']?>" title="Retrieves issues due before or on this date" type="text">			</td>
		</tr>
		<tr>
			<td bgcolor="#FFFFF0">Due Date:</td>
			<td>
				<label for="duedatePrevious" class="label">From</label>
				<input name="duedatePrevious" id="updatedPrevious" class="periodSearcher" value="" type="text" style="width:40px">
				<label for="duedateNext" class="label">To</label>
				<input name="duedateNext" id="duedateNext" class="periodSearcher" value="" type="text" style="width:40px">
				<div class="fieldDescription">Use this picker for relative dates</div>			</td>
		</tr>
		<tr>
			<td colspan="2"><input type="hidden" name="id" value="<?=$this->id?>"/></td>
		</tr>
		<tr>
			<td height="24" colspan="2" align="center" bgcolor="#F0F0F0">
				<input name="hide" value="&lt;&lt; View &amp; Hide" type="submit">
			<input name="show" value="View &gt;&gt;" type="submit"></td>
		</tr>
	</table>
	</form>
</td>
<td valign="top">
<br>
<?php if(isset($this->issuesData)) {
		if (empty($this->issuesData)) {?>
			<table width="98%">
				<tr>
					<td>
						<table width = "100%" align = "center" bgcolor="#bbbbbb" cellspacing="0" style="border:1px solid #bbbbbb">
                      <tr bgcolor="#f0f0f0">
                        <td style="border-bottom:0px"><h3 style="margin:3px 0 0 5px;height:20px">Issue Navigator</h3>
                          </td>
                      </tr>
                      <tr>
                        <td bgcolor="#ffffff">&nbsp;There is no matching issue.</td>
                      </tr>
                    </table>
					</td>
				</tr>
			</table>
		<?php } else { ?>
<table width = "98%" align="center" border="0" cellpadding="0" cellspacing="0">
	<tbody>
		<tr>
			<td>
			<table width = "98%" align="center" border="0" cellpadding="0" cellspacing="0">
              <tbody>
                <tr>
                  <td><table width = "100%" align = "center" bgcolor="#bbbbbb" cellspacing="0" style="border:1px solid #bbbbbb">
                      <tr bgcolor="#f0f0f0">
                        <td style="border-bottom:0px"><h3 style="margin:3px 0 0 5px;height:20px">Issue Navigator</h3>
                          Displaying issues 1 to 16 of matching 16 issues. </td>
                      </tr>
                      <tr>
                        <td bgcolor="#ffffff"><b>Current View:</b> <br/>
                          Browser <span style="font-size:10px">( Current Fields  | Printable  | Full Content  )</span> | XML  | RSS <span style="font-size:10px">( Issues  | Comments  )</span> | Word  | Excel <span style="font-size:10px">( All fields  | Current fields  )</span> </td>
                      </tr>
                    </table>
                      <br />
                      <table id="issuetable" border="0" cellpadding="3" cellspacing="1" width="100%" bgcolor="#bbbbbb">
                        <tbody>
                          <tr bgcolor="#f0f0f0">
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>T</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Key</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Summary</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Assignee</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Reporter</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Rr</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Status</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Res</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Created</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Updated</b></td>
                            <td class="colHeaderLink" onMouseOver="this.className='colHeaderOver'" onMouseOut="this.className='colHeaderLink'" width="1%" nowrap><b>Due</b></td>
                          </tr>
                          <?php 
						$i = 1;
						foreach ($this->issuesData as $issue) { ?>
                          <tr <?php if($i % 2) { echo "class='rowNormal'"; } else { echo "class='rowAlternate'";}?>>
                            <td><img src= "<?=$this->baseUrl().$issue['issueTypeIcon']?>" title="<?=$issue['issueTypeName']?>"/> </td>
                            <td><?php echo $issue['pkey']?></td>
                            <td class="nav summary"><a href="<?=$this->baseUrl()?>/issue/view/id/<?=$issue['id']?>"><?php echo $issue['summary']?></a></td>
                            <td class="nav assignee"><?php echo $issue['assignee']?></td>
                            <td class="nav reporter"><?php echo $issue['reporter']?></td>
                            <td class="nav priority"><img src= "<?=$this->baseUrl().$issue['priorityIcon']?>" title="<?=$issue['priorityName']?>"/> </td>
                            <td class="nav status" align="center"><img src= "<?=$this->baseUrl().$issue['issueStatusIcon']?>" title="<?=$issue['issueStatusName']?>"/>&nbsp;
                                <?=$issue['issueStatusName']?>
                            </td>
                            <td class="nav resolution"><?php if ($issue['resolutionName']) {
							echo $issue['resolutionName'];
						} else {
							echo '<font style="color:red">Unresolved</font>';
						}
						?></td>
                            <td class="nav created"><?php 
								Zend_Date::setOptions(array('format_type' => 'php'));
								$created = new Zend_Date(strtotime($issue['created']));
								print $created->toString("F j, Y");
							?>
                            </td>
                            <td class="nav updated"><?php
								$updated = new Zend_Date(strtotime($issue['updated']));
								print $updated->toString("F j, Y");
							?>
                            </td>
                            <td class="nav duedate"><?php 
								$duedate = new Zend_Date(strtotime($issue['duedate']));
								print $duedate->toString("F j, Y");	
							?>
                            </td>
                          </tr>
                          <?php 
							$i++;
						}?>
                        </tbody>
                    </table>
					
					</td>
                </tbody>
            </table>
			  <br /></td>
	</tbody>
</table>
<?php
	} 
} else {
?>
<table width = "98%" align="center" border="0" cellpadding="0" cellspacing="0">
	<tbody>
		<tr>
			<td>
				<table width = "100%" align = "center" bgcolor="#bbbbbb" cellspacing="0" style="border:1px solid #bbbbbb">
					<tr bgcolor="#f0f0f0">
					  <td style="border-bottom:0px">
								<h3 style="margin:3px 0 0 5px;height:20px">Issue Navigator</h3>
						<br/>
						</td>
					</tr>
					<tr>
						<td height="83" bgcolor="#ffffff"><p> The Issue Navigator allows you to browse all the issues in the system.  Filters allow you to limit the issues that you see. </p>
					    <p> Using the panel on the left, you can create and edit new filters. </p></td>
					</tr>
				</table>
				<br /></td>
	</tbody>
</table>
<?php }
?>
</td>
</tr>
</tbody>
</table>
<script>
	function save()
	{
		document.getElementById('edit').action = "<?=$this->baseUrl()?>/filter/save";
		document.getElementById('edit').submit();
	}
</script>
<script type="text/javascript">
//<!--
$(document).ready(function() {
    $("#createdAfter").datepicker({"defaultDate":"2009\/10\/17"});
	$("#createdBefore").datepicker({"defaultDate":"2009\/10\/17"});
	$("#updatedAfter").datepicker({"defaultDate":"2009\/10\/17"});
	$("#updatedBefore").datepicker({"defaultDate":"2009\/10\/17"});
	$("#duedateAfter").datepicker({"defaultDate":"2009\/10\/17"});
	$("#duedateBefore").datepicker({"defaultDate":"2009\/10\/17"});
});
//-->
</script>